import { getContainerOptions, getPodOptions } from "@/api/topoNodeDetail";
import { ref } from "vue";

export default function useFlameForm(props) {
  const podList = ref([]);
  const containerList = ref([]);
  const getPodList = (node = props.node) => {
    const { masterIp, namespace, workloadName: workload } = node;
    getPodOptions({ masterIp, namespace, workload }).then((res) => {
      console.log(res.data, "res.data.data");

      podList.value = res.data || [];
    });
  };
  const getContainerList = (pod) => {
    const { masterIp, namespace } = props.node;
    getContainerOptions({ masterIp, namespace, pod }).then((res) => {
      containerList.value = res.data;
    });
  };
  return {
    podList,
    containerList,
    getPodList,
    getContainerList,
  };
}
